package com.yu.demo.controller;

import com.github.pagehelper.Page;
import com.yu.demo.api.UserApi;
import com.yu.demo.dao.entity.User;
import com.yu.demo.pojo.dto.UserDTO;
import com.yu.demo.pojo.query.UserQuery;
import com.yu.demo.pojo.vo.ResultVO;
import com.yu.demo.pojo.vo.UserVo;
import com.yu.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author: WengYu
 * @CreateTime: 2022/05/31 14:59
 */
@RestController
public class UserController implements UserApi {

    @Autowired
    private UserService userService;

    @Override
    public Boolean add(@RequestBody UserDTO userDTO) {
        return userService.add(userDTO);
    }

    @Override
    public Boolean delete(Long id) {
        return userService.delete(id);
    }

    @Override
    public Boolean update(@RequestBody UserDTO userDTO) {

        return userService.update(userDTO);
    }

    @Override
    public ResultVO<List<UserVo>> search(UserQuery userQuery) {
        return userService.search(userQuery);
    }
}
